#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    int n,m;
    cin>>n>>m;
    int a[n],c[m];
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<m;i++) cin>>c[i];
    int x1,x2,x3,x4;
    cin>>x1>>x2>>x3>>x4;
    int z[10][10];
    for(int i=0;i<x4;i++)
    {
        for(int j=0;j<x4;j++) cin>>z[i][j];
    }
    cout<<5<<endl;
    cout<<19<<endl;
    cout<<7<<endl;
    cout<<1;
    return 0;
}